package game.component;

import math.vector.vec3f;

public class Position 
{
    
    private vec3f pos; // Position of camera
    public vec3f pos()
    {
        return pos;
    }
    
    private vec3f posStart;
    public vec3f posStart()
    {
        return posStart;
    }
    
    public Position() 
    {
        pos = new vec3f();
        posStart = new vec3f();
    }
    
    public void updateAdd(float dX, float dY, float dZ) 
    {
        pos.add(dX, dY, dZ);
    }
    
    public void updateAdd(vec3f delta) 
    {
        this.updateAdd(delta.x, delta.y, delta.z);
    }
    
    public void updateSub(float dX, float dY, float dZ) 
    {
        pos.subtract(dX, dY, dZ);
    }
    
    public void updateSub(vec3f delta) 
    {
        this.updateSub(delta.x, delta.y, delta.z);
    }

    public void setStart(float sx, float sy, float sz) 
    {
        posStart = new vec3f(sx, sy, sz);
        this.reset();
    }
    
    public void setStart(vec3f startPos) 
    {
        this.setStart(startPos.x, startPos.y, startPos.z);
    }
    
    public void reset() 
    {
        pos.setTo(posStart);
    }
    
    public String toString() 
    {
        String s = "";
        s += "POSITION COMPONENT";
        s += "\n   " + pos;
        return s;
    }
    
}
